import java.util.*;

/**
 * @author LKQ
 * @date 2022/3/16 9:53
 * @description
 */
public class Solution3 {
    public static void main(String[] args) {

    }
    public int findMiddleIndex(int[] nums) {
        int total = 0;
        for(int num : nums) {
            total += num;
        }
        int left = 0, right = total;
        for (int i = 0; i < nums.length; i++) {
            right -= nums[i];
            if (left == right) {
                return i;
            }
            left += nums[i];
        }
        return -1;
    }
}
